<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>Add a private Authorization Rule class</Title>
      <Author>Rockford Lhotka</Author>
      <Description>Add a private Authorization Rule class.</Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>cslarulea</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>ClassName</ID>
          <ToolTip>Enter authorization rule name </ToolTip>
          <Default>RuleName</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="vb" Kind="type decl"><![CDATA[Public Class $ClassName$
	Inherits Csla.Rules.AuthorizationRule
	' TODO: Add additional parameters to your rule to the constructor
	''' <summary>
	''' Initializes a new instance of the <see cref="AuthorizationRule"/> class.
	''' </summary>
	''' <param name="action">Action this rule will enforce.</param>
	''' <param name="element">Method or property.</param>
	Public Sub New(action As AuthorizationActions, element As IMemberInfo$end$)
		MyBase.New(action, element)
	    ' TODO: Add additional constructor code here 
		' CacheResult = False

		' TODO: Add additional constructor code here 


	End Sub


	' TODO: Add additional parameters to your rule to the constructor
	''' <summary>
	''' Initializes a new instance of the <see cref="AuthorizationRule"/> class.
	''' </summary>
	''' <param name="action">The action.</param>
	Public Sub New(action As AuthorizationActions)
		MyBase.New(action)			
	    ' TODO: Add additional constructor code here 
		' CacheResult = False
		
		' TODO: Add additional constructor code here 


	End Sub
  
	' TODO: Uncomment this property if rule result is not static. 
	''' <summary>
	'''  Notify RuelEngine that the result of this AuthzRule can not be cached. 
	'''  Default is true so AuthzRules will only run once.
	''' </summary>
	'Public Overrides ReadOnly Property CacheResult() as Boolean
	'   Get
	'     Return False
	'  End Get
	'End Property

	Protected Overrides Sub Execute(context As AuthorizationContext)
		' TODO: Add actual rule code here. 
		'if (!access_condition)
		'{
		'  context.HasPermission = false;
		'}
	End Sub
End Class
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>